<template>
    <div class="hospital_all">
        <div class="search">
            <div class="left">
                <!-- 医生VRID -->
                <div class="search_list">
                    <span class="search_text">医生VRID：</span>
                    <el-input size="small" placeholder="输入" v-model="doctor_id"></el-input>
                </div>
            </div>
            <div class="center">
                <!--医生主数据ID-->
                <div class="search_list">
                    <span class="search_text">医生主数据ID：</span>
                    <el-input size="small" placeholder="输入" v-model="doctor_physician_data_id"></el-input>
                </div>
            </div>
            <div class="right">
                <!--医生姓名-->
                <div class="search_list">
                    <span class="search_text">医生姓名：</span>
                    <el-input size="small" placeholder="输入" v-model="doctor_name"></el-input>
                </div>
            </div>
        </div>
        <!--列表-->
        <div class="list blockMould doctor_list">
            <div class="list_head_button">
                <div class="search_name">
                    <el-button size="mini" type="primary" @click="search_list">查询</el-button>
                    <el-button size="mini" @click="reset_list">重置</el-button>
                </div>
            </div>
            <el-table
                :header-cell-style="{background:'#F6F7FB',color:'#666666',height: '50px'}"
                :row-class-name="tableRowClassName"
                :data="doctorList">
                <el-table-column
                    prop="doctorId"
                    label="医生VRID"
                    min-width="80">
                </el-table-column>
                <el-table-column
                    prop=""
                    label="医生主数据ID"
                    min-width="100">
                </el-table-column>
                <el-table-column
                    label="医生"
                    min-width="80">
                    <template slot-scope="scope">
                        <span @click="getDoctorInfo(scope.row)">{{scope.row.doctorName}}</span>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="hospitalName"
                    label="医院"
                    min-width="130"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop="depart"
                    label="科室"
                    min-width="90">
                </el-table-column>
                <el-table-column
                    prop="province"
                    label="省份"
                    min-width="80">
                </el-table-column>
                <el-table-column
                    prop="city"
                    label="城市"
                    min-width="70">
                </el-table-column>
                <el-table-column
                    prop="techTitle"
                    label="职称"
                    min-width="90">
                </el-table-column>
                <el-table-column
                    prop="executeTitle"
                    label="职务"
                    min-width="90"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    label="操作"
                    min-width="50">
                    <template slot-scope="scope">
                        <el-tooltip popper-class="operation_button_promit" effect="dark" content="编辑" placement="bottom">
                            <el-button type="text" @click="edit_info(scope.row)">
                                <img src="../../assets/common/edit.svg" alt="">
                            </el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
            <!--分页-->
            <pagination :page="page" @changeCurrentPage="handleCurrentChange" @changePageSize="handlePageSize"/>
        </div>
        <!--编辑医院-->
        <el-dialog
        title="编辑"
        :visible.sync="dialogVisible"
        width="600px"
        :before-close="closeDoctorDialog"
        class="edit">
            <el-tabs v-model="activeDoctorName">
                <el-tab-pane label="医生信息" name="doctorInfo" class="doctor_info">
                    <div class="search_list name">
                        <span class="mandatory_logo">*</span>
                        <span class="search_text">姓名：</span>
                        <el-input
                            class="input_text"
                            size="small"
                            v-model="dialog_doctor_name"
                            placeholder="请输入姓名">
                        </el-input>
                    </div>
                    <div class="search_list sex">
                        <span class="mandatory_logo">*</span>
                        <span class="search_text">性别：</span>
                        <el-select class="doctor_select" size="small" v-model="dialog_sex" placeholder="请选择">
                            <el-option
                                v-for="item in sexList"
                                :key="item.id"
                                :label="item.name"
                                :value="item.name">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="search_list phone_search_list">
                        <div class="text">
                            <span class="mandatory_logo">*</span>
                            <span class="search_text">电话：</span>
                        </div>
                        <div class="phone_content">
                            <div
                                class="input_text"
                                style="display:flex;align-items:center"
                                v-for="(item,index) in dialog_phone"
                                :key="index">
                                <el-input
                                    size="small"
                                    v-model="item.phone"
                                    placeholder="请输入电话">
                                </el-input>
                                <i
                                    class="el-icon-circle-plus-outline icon"
                                    style="transform: translateX(10px);cursor: pointer;color: #5687FF"
                                    @click="add_phone"
                                    v-if="item.isShowAdd"></i>
                                <i
                                    class="el-icon-circle-close icon"
                                    style="transform: translateX(18px);cursor: pointer;color:#EA5E32"
                                    @click="delete_phone(index)"
                                    v-if="item.isShowDelete"></i>
                            </div>
                        </div>
                    </div>
                    <div class="search_list hospital">
                        <span class="mandatory_logo">*</span>
                        <span class="search_text">医院：</span>
                        <el-autocomplete
                            class="doctor_select"
                            v-model="dialog_hospital"
                            :fetch-suggestions="querySearch"
                            placeholder="请输入内容"
                            :trigger-on-focus="false">
                        </el-autocomplete>
                    </div>
                    <div class="search_list depart">
                        <span class="search_text">科室：</span>
                        <el-select
                            class="doctor_select select_text"
                            size="small"
                            filterable
                            clearable
                            v-model="dialog_depart"
                            placeholder="请选择">
                            <el-option
                                v-for="(item,index) in dialogDepartList"
                                :key="index"
                                :label="item.resourceItem"
                                :value="item.resourceItem">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="search_list techtitle">
                        <span class="search_text">职称：</span>
                        <el-select
                            class="doctor_select select_text"
                            size="small"
                            filterable
                            clearable
                            v-model="dialog_tech_title"
                            placeholder="请选择">
                            <el-option
                                v-for="item in dialogTeachList"
                                :key="item.resourceValue"
                                :label="item.resourceItem"
                                :value="item.resourceItem">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="search_list executetitle">
                        <span class="search_text">职务：</span>
                        <el-select
                            class="doctor_select select_text"
                            size="small"
                            filterable
                            clearable
                            v-model="dialog_execute_title"
                            placeholder="请选择">
                            <el-option
                                v-for="item in dialogExecuteList"
                                :key="item.resourceValue"
                                :label="item.resourceItem"
                                :value="item.resourceItem">
                            </el-option>
                        </el-select>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="基础标签" name="basicLabel" class="basic_label">
                    <div
                        class="option"
                        v-for="(item,index) in basic_label"
                        :key="index">
                        <!-- 文字文本框 -->
                        <div class="search_list text_input" v-if="item.tagType === 'text'">
                        <span>{{item.tagName}}：</span>
                        <el-input
                            v-model="item.optionName"
                            placeholder="请输入内容"
                            @input="changeTextInput(item.optionName)">
                        </el-input>
                        </div>
                        <!-- 数字文本框 -->
                        <div class="search_list number_input" v-if="item.tagType === 'number'">
                        <span>{{item.tagName}}：</span>
                        <el-input
                            v-model="item.optionName"
                            placeholder="请输入数字"
                            @input="changeTextInput(item.optionName)">
                        </el-input>
                        </div>
                        <!-- 单选下拉框 -->
                        <div class="search_list radio_select" v-if="item.tagType === 'radio'">
                        <span>{{item.tagName}}：</span>
                        <el-select
                        v-model="item.chooseRadioTag"
                        placeholder="请选择"
                        clearable
                        @change="changeRadioTag($event,index)">
                            <el-option
                                v-for="val in item.tagBaseOptionBeanList"
                                :key="val.id"
                                :label="val.optionName"
                                :value="val.id"
                                :value-key="val.id">
                            </el-option>
                        </el-select>
                        </div>
                        <!-- 多选下拉框 -->
                        <div class="search_list checkbox_select" v-if="item.tagType === 'checkbox'">
                        <span>{{item.tagName}}：</span>
                        <el-select
                            v-model="item.chooseCheckTag"
                            multiple
                            collapse-tags
                            placeholder="请选择"
                            @change="changeCheckTag($event,index)">
                                <el-option
                                v-for="val in item.tagBaseOptionBeanList"
                                :key="val.id"
                                :label="val.optionName"
                                :value="val.id"
                                :value-key="val.id">
                                </el-option>
                        </el-select>
                        </div>
                    </div>
                </el-tab-pane>
            </el-tabs>
            <span slot="footer" class="dialog-footer">
                <el-button @click="cancelDoctorDialog">取消</el-button>
                <el-button type="primary" @click="edit_doctor_info">确定</el-button>
            </span>
        </el-dialog>
        <!-- 侧边弹框 -->
        <drawer/>
        <!-- 拜访登记 -->
        <phone/>
    </div>
</template>

<script>
    import pagination from '../public/pagination';
    import {api, baseAjax, decryptMobile} from '../../api/api';
    import {statusCode} from '../../utils/index';
    import drawer from '../../element/drawer';
    import bus from '../../assets/js/eventBus';
    import Cookies from 'js-cookie';
    import phone from '../../element/phone';
    import EncryUtil from "@/utils/encrypt";
    export default {
        name: "doctorManagement",
        components:{
            pagination,
            drawer,
            phone
        },
        data() {
            return {
                //分页
                page: {
                    currentPage: 1,    //当前页
                    pageSize: 10,    //每页显示条数
                    totalPage: 0,   //总页数
                    total:null   //总条数
                },
                dialogVisible:false,
                doctor_id:null,   //医生VRID
                doctor_physician_data_id:'',  //医生主数据ID
                doctor_name:'',  //医生姓名
                doctorList:[],   //医生列表
                dialog_doctor_name:'',   //编辑医生姓名
                dialog_phone:[{
                    phone:'',
                    isShowAdd:true,
                    isShowDelete:false
                }],  //编辑电话
                dialog_sex:'',   //编辑性别
                sexList:[     //编辑性别下拉框值
                    {
                        id:1,
                        name:'男'
                    },
                    {
                        id:2,
                        name:'女'
                    }
                ],
                dialog_hospital:'',   //编辑医院
                dialogHospitalList:[],   //编辑医院下拉框值
                dialog_depart:'',   //编辑科室
                dialogDepartList:[],  //编辑科室下拉框值
                dialog_tech_title:'',   //编辑职称
                dialogTeachList:[],   //编辑职称下拉框值
                dialog_execute_title:'',  //编辑职务
                dialogExecuteList:[],   //编辑职务下拉框值
                basic_label:[],  //基础标签
                user_info:{},
                edit_doctor_id:null,  //编辑医生id
                history_concat:[],   //编辑之前的联系方式
                select_phone:[], //编辑手机号
                activeDoctorName:'doctorInfo'
            }
        },
        mounted(){
            this.user_info = JSON.parse(this.EncryUtil.decryptByAES(Cookies.get('user_info')));
            this.getDoctorListInfo();
            this.getDepart('depart');  //获取科室
            this.getTechTitle('execute_title');  //获取职称
            this.getExecuteTitle('tech_title');  //获取职务
            this.getAllHospital();//获取所有医院
        },
        methods: {
            //修改列表tr颜色
            tableRowClassName({row, rowIndex}) {
                if (rowIndex % 2 === 1) {
                return 'success_row';
                }
                return '';
            },
            //改变当前页码
            handleCurrentChange(currentPage) {
                this.page.currentPage = currentPage;
                this.getDoctorListInfo();
            },
            //改变每页条数
            handlePageSize(pageSize){
                this.page.pageSize = pageSize;
                this.getDoctorListInfo();
            },
            //增加电话
            add_phone(){
                if(this.dialog_phone.length >= 5){
                    this.$alert('最多只能添加5个手机号');
                }else{
                    this.dialog_phone.push({
                        phone:'',
                        isShowAdd:false,
                        isShowDelete:true
                    });
                }
            },
            //删除电话
            delete_phone(index){
                if(this.dialog_phone.length <= 1){
                    this.$alert('已经是最后一个手机号了，不可删除');
                }else{
                    this.dialog_phone.splice(index,1);
                }
            },
            //编辑信息
            edit_info(info){
                let that = this;
                let tag_basic_label = [];
                this.select_phone = [];
                info.doctorContact.forEach(item=>{
                  decryptMobile(item).then((res) => {
                    if (res.data.code === statusCode.success) {
                      this.select_phone.push({
                        phone:res.data.data,
                        isShowAdd:false,
                        isShowDelete:true
                      });
                      this.select_phone[0].isShowAdd = true;
                      this.select_phone[0].isShowDelete = false;
                    }
                  })
                });
                setTimeout(()=>{
                  let select_phone = JSON.parse(JSON.stringify(this.select_phone))
                  this.dialog_phone = select_phone.length ? select_phone : [{phone:''}];
                  this.dialogVisible = true;
                },500);
                this.dialog_doctor_name = info.doctorName;
                this.dialog_sex = info.gender;
                this.dialog_hospital = info.hospitalName;
                this.dialog_depart = info.depart;
                this.dialog_tech_title = info.techTitle;
                this.dialog_execute_title = info.executeTitle;
                this.edit_doctor_id = info.doctorId;
                this.history_concat = info.doctorContact;
                api.visit_result_basic_label = {
                    url:api.visit_result_basic_label_url+'?doctorId='+info.doctorId,
                    method:api.visit_result_basic_label.method
                };
                baseAjax(api.visit_result_basic_label, '', (res)=>{
                    if(res.code === statusCode.success){
                        res.data.forEach(item=>{
                            tag_basic_label.push(item.tagBaseList);
                        });
                        that.basic_label = tag_basic_label.flat();
                        that.basic_label.forEach(item=>{
                            item.chooseRadioTag = null;  //单选
                            item.chooseCheckTag = [];  //多选
                            item.tagBaseOptionBeanList.forEach(val=>{
                                if(val.doctorChoose === true){
                                    if(item.tagType === 'radio'){
                                        item.chooseRadioTag = val.id;
                                    }else if(item.tagType === 'checkbox'){
                                        item.chooseCheckTag.push(val.id)
                                    }
                                }
                            });
                            if(item.tagType === 'number' || item.tagType === 'text'){
                                if(item.tagBaseOptionBeanList.length && item.tagBaseOptionBeanList[0].doctorChoose == true){
                                    item.optionName = item.tagBaseOptionBeanList.length ? item.tagBaseOptionBeanList[0].optionName : '';
                                    item.optionId = item.tagBaseOptionBeanList.length ? item.tagBaseOptionBeanList[0].id : '';
                                }
                            }
                        });
                    }
                });
            },
            //编辑医生信息
            edit_doctor_info(){
                let that = this;
                let phone_val = this.dialog_phone.every(item=>{
                    return item.phone !== '';
                });
                let phone_reg = this.dialog_phone.every(item=>{
                    return /^(1|\d){10,12}$/.test(item.phone);
                });
                if(!this.dialog_doctor_name){
                    this.$alert('请填写"姓名"');
                }else if(this.dialog_doctor_name.length > 10){
                    this.$alert('"姓名"不能大于10个字')
                }else if(phone_val == false){
                    this.$alert('请填写"电话"');
                }else if(phone_reg == false){
                    this.$alert('请填写正确的电话');
                }else if(!this.dialog_sex){
                    this.$alert('请选择"性别"');
                }else if(!this.dialog_hospital){
                    this.$alert('请选择"医院"');
                }else{
                    let gender = null;
                    if(this.dialog_sex === '男'){
                        gender = 1;
                    }else if(this.dialog_sex === '女'){
                        gender = 2;
                    }else{
                        gender = 0;
                    }
                    let data = {
                        contactList:this.dealChangeConcat(),
                        contactListOld:this.dealHistoryConcat(),
                        currentPage:this.page.currentPage,
                        dept:this.dialog_depart,
                        doctorName:this.dialog_doctor_name,
                        executeTitle:this.dialog_execute_title,
                        gender:gender,
                        hospitalId:this.dealHospital(),
                        hospitalName:this.dialog_hospital,
                        id:Number(this.edit_doctor_id),
                        pageSize:this.page.pageSize,
                        tagBaseOptionBeanList:this.dealBasicLabel().tagBaseOptionBeanList,
                        tagBaseOptionIdList:this.dealBasicLabel().tagBaseOptionIdList,
                        tagBaseQuateBeanList:this.dealBasicLabel().tagBaseQuateBeanList,
                        techTitle:this.dialog_tech_title,
                        totalPage:this.page.totalPage
                    };
                    // console.log(data)
                    baseAjax(api.edit_doctor_infos, data, (res)=>{
                        if(res.code === statusCode.success){
                            if(res.data == true){
                                that.$message.success('编辑成功');
                                that.dialogVisible = false;
                                that.dialog_doctor_name = '';
                                that.dialog_phone = [{phone:'',isShowAdd:true,isShowDelete:false}];
                                that.dialog_sex = '';
                                that.dialog_hospital = '';
                                that.dialog_depart = '';
                                that.dialog_tech_title = '';
                                that.dialog_execute_title = '';
                                that.edit_doctor_id = null;
                                that.history_concat = [];
                                that.activeDoctorName = 'doctorInfo';
                                that.getDoctorListInfo();
                            }else{
                                that.$message.error('编辑失败');
                            }
                        }
                    });
                }
            },
            //处理修改后的联系方式
            dealChangeConcat(){
                let contactList = [];
                this.dialog_phone.forEach(item=>{
                    contactList.push({
                        contact:item.phone,
                        doctorId:this.edit_doctor_id,
                        type:1
                    });
                });
                return contactList;
            },
            //处理历史联系方式
            dealHistoryConcat(){
                let contactListOld = [];
                this.history_concat.forEach(item=>{
                    contactListOld.push({
                        contact:item,
                        doctorId:this.edit_doctor_id,
                        type:1
                    });
                });
                return contactListOld;
            },
            //处理医院id
            dealHospital(){
                let that = this;
                let hospital_id = null;
                this.dialogHospitalList.forEach(item=>{
                    if(that.dialog_hospital === item.value){
                        hospital_id = item.id;
                    }
                });
                return hospital_id;
            },
            //处理基础标签
            dealBasicLabel() {
                let that = this;
                let tagBaseOptionIdList = [];  //基础标签文本框id
                let tagBaseQuateBeanList = [];  //基础标签-下拉框
                let tagBaseOptionBeanList = [];   //基础标签-文本框
                //基础标签
                this.basic_label.forEach(item => {
                    if (item.tagType === 'radio' || item.tagType === 'checkbox') {
                        if (item.chooseCheckTag.length) {  //多选
                            item.chooseCheckTag.forEach(val => {
                                if (val) {
                                    tagBaseQuateBeanList.push({
                                        doctorId: Number(this.edit_doctor_id),
                                        optionId: val,
                                        repId: that.user_info.repId,
                                        sinToken: null,
                                        sysStatus: '1',
                                        tagClassifyId: item.tagClassifyId,
                                        tagId: item.id
                                    });
                                }
                            });
                        } else {  //单选
                            if (item.chooseRadioTag) {
                                tagBaseQuateBeanList.push({
                                    doctorId: Number(this.edit_doctor_id),
                                    optionId: item.chooseRadioTag,
                                    repId: that.user_info.repId,
                                    sinToken: null,
                                    sysStatus: '1',
                                    tagClassifyId: item.tagClassifyId,
                                    tagId: item.id
                                });
                            }
                        }
                    } else {
                        if (item.optionName) {
                            tagBaseQuateBeanList.push({
                                doctorId: Number(this.edit_doctor_id),
                                optionId: 0,
                                repId: that.user_info.repId,
                                sinToken: null,
                                sysStatus: '1',
                                tagClassifyId: item.tagClassifyId,
                                tagId: item.id
                            });

                            tagBaseOptionBeanList.push({
                                optionName: item.optionName,
                                optionType: 'subjective',
                                sysStatus: '1',
                                tagClassifyId: item.tagClassifyId,
                                tagClassifyName: item.tagClassifyName,
                                tagId: item.id,
                                tagType: item.tagType
                            });
                        }
                        if (item.optionId) {  //基础标签-文本框id
                            tagBaseOptionIdList.push(item.optionId);
                        }
                    }
                });
                return {tagBaseQuateBeanList, tagBaseOptionBeanList, tagBaseOptionIdList};
            },
            //取消关闭弹窗
            cancelDoctorDialog(){
                this.dialogVisible = false;
                this.dialog_doctor_name = '';
                this.dialog_phone = [{phone:'',isShowAdd:true,isShowDelete:false}];
                this.dialog_sex = '';
                this.dialog_hospital = '';
                this.dialog_depart = '';
                this.dialog_tech_title = '';
                this.dialog_execute_title = '';
                this.edit_doctor_id = null;
                this.history_concat = [];
                this.activeDoctorName = 'doctorInfo';
            },
            //关闭弹框清空表单元素
            closeDoctorDialog(done){
                this.dialog_doctor_name = '';
                this.dialog_phone = [{phone:'',isShowAdd:true,isShowDelete:false}];
                this.dialog_sex = '';
                this.dialog_hospital = '';
                this.dialog_depart = '';
                this.dialog_tech_title = '';
                this.dialog_execute_title = '';
                this.edit_doctor_id = null;
                this.history_concat = [];
                this.activeDoctorName = 'doctorInfo';
                done();
            },
            //获取医生基本信息
            getDoctorInfo(info){
                let doctor_info = this.dealDoctorInfo(info);
                Cookies.set('doctor_info', this.EncryUtil.encryptByAES(JSON.stringify(doctor_info)), {expires: 24 * 60 * 60 * 1000});
                let data = {
                    is_drawer:true,  //是否显示侧边弹框 true-显示 false-隐藏
                    is_supplement:true   //是否显示补填信息按钮  true-显示  false-隐藏
                };
                bus.$emit('get_doctor_info',data);
            },
            //处理医生信息
            dealDoctorInfo(info){
                let doctor_info = {
                    name:info.doctorName,
                    position:info.techTitle,
                    hospital:info.hospitalName,
                    department:info.depart,
                    sex:info.gender,
                    project:[],
                    doctorId:info.doctorId,
                    techTitle:info.techTitle,
                    executeTitle:info.executeTitle,
                    hcoProvince:info.province,
                    hcoCity:info.city,
                    concat:info.doctorContact
                };
                return doctor_info;
            },
            //获取医生列表数据
            getDoctorListInfo(){
                let that = this;
                let data = {
                    currentPage:this.page.currentPage,
                    doctorId:this.doctor_id,
                    doctorName:this.doctor_name,
                    pageSize:this.page.pageSize,
                    totalPage:this.page.totalPage
                };
                baseAjax(api.get_doctor_info, data, (res)=>{
                    if(res.code === statusCode.success){
                        let {pageSize, totalPage, value, count} = res.data;
                        that.page.pageSize = pageSize;
                        that.page.totalPage = totalPage;
                        that.page.total = count;
                        that.doctorList = value;
                    }
                });
            },
            //搜索
            search_list(){
                this.handleCurrentChange(1);
            },
            //重置
            reset_list(){
                this.doctor_id = '';
                this.doctor_name = '';
                this.doctor_physician_data_id = '';
            },
            //改变基础标签文字/数字
            changeTextInput(val){
                this.basic_label.optionName = val;
                this.$forceUpdate();
                this.$set(this.basic_label);
            },
            //改变单选下拉框值
            changeRadioTag(val,index){
                this.basic_label.chooseRadioTag = val;
                this.$forceUpdate();
                this.$set(this.basic_label);
            },
            //改变多选下拉框值
            changeCheckTag(val,index){
                this.basic_label.chooseCheckTag = val;
                this.$forceUpdate();
                this.$set(this.basic_label);
            },
            //获取科室
            getDepart(type){
                this.getResourceInfo(type);
            },
            //获取职称
            getTechTitle(type){
                this.getResourceInfo(type);
            },
            //获取职务
            getExecuteTitle(type){
                this.getResourceInfo(type);
            },
            //获取资源信息
            getResourceInfo(type){
                let that = this;
                api.get_resource_item = {
                    url:api.get_resource_item_url+type,
                    method:api.get_resource_item.method
                };
                baseAjax(api.get_resource_item, '', (res)=>{
                    if(res.code === statusCode.success){
                        if(type === 'depart'){  //科室
                            that.dialogDepartList = res.data;
                        }else if(type === 'execute_title'){  //职称
                            that.dialogTeachList = res.data;
                        }else if(type === 'tech_title'){  //职务
                            that.dialogExecuteList = res.data;
                        }
                    }
                })
            },
            //获取所有医院
            getAllHospital(){
                let that = this;
                baseAjax(api.get_all_hospital, '', (res)=>{
                    if(res.code === statusCode.success){
                        res.data.forEach(item=>{
                            that.dialogHospitalList.push({
                                id:item.id,
                                value:item.hospitalName
                            });
                        });
                    }
                });
            },
            //输入匹配医院
            querySearch(queryString, cb){
                let results = queryString ? this.dialogHospitalList.filter(this.createFilter(queryString)) : this.dialogHospitalList;
                cb(results);
            },
            createFilter(queryString) {
                return (dialogHospital) => {
                    return (dialogHospital.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1);
                };
            }
        }
    }
</script>

<style lang="less" scoped>
.hospital_all{
    font-family: PingFangSC-Regular, PingFang SC;
    /deep/.el-input.el-input--suffix.is-focus>.el-input__inner{
        border-color:#2A82E2;
    }
    /deep/.el-input__inner:focus{
        border-color:#2A82E2 !important;
    }
    /deep/.el-range-editor.is-active{
        border-color:#2A82E2 !important;
    }
    .search{
        .left,.center{
            margin-right:80px;
        }
        .left{
            .search_text{
                min-width:76px !important;
            }
        }
        .center{
            .search_text{
                min-width:99px !important;
            }
        }
    }
    .doctor_list{
        .list_head_button{
            justify-content:flex-end;
        }
        /deep/.el-table{
            thead{
                tr{
                    th:first-child{
                        padding-left:9px;
                    }
                }
            }
            tbody{
                tr{
                    td:first-child{
                        padding-left:28px;
                    }
                    td:nth-child(3){
                        .cell{
                            color: #2A82E2;
                            cursor: pointer;
                        }
                    }
                    td:last-child{
                        .cell{
                            .el-button{
                                margin:0;
                            }
                        }
                    }
                }
            }
        }
    }

    .mandatory_logo{ 
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #F65C44;
        display: inline-block;
        transform: translateY(3px);
        margin-right:2px;
    }

    /deep/.edit{
        .el-dialog{
            padding:18px 25px 32px 32px;
            .el-dialog__header{
                    padding:0;
                    display:flex;
                    align-items:center;
                    .el-dialog__title{
                    font-size: 18px;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: #202020;
                }
                .el-dialog__headerbtn{
                    right:22px;
                    .el-dialog__close{
                            color:#666666;
                    }
                }
            }
            .el-dialog__body{
                padding:0;
                .el-tabs{
                    .el-tabs__header{
                        margin-bottom:20px;
                        .el-tabs__nav-wrap{
                            .el-tabs__nav-scroll{
                                margin-top: 13px;
                                .el-tabs__nav{
                                    .el-tabs__item{
                                        font-size: 14px;
                                        font-family: PingFangSC-Regular, PingFang SC;
                                        font-weight: 400;
                                        color: #000000;
                                        height:34px;
                                        line-height:35px;
                                    }
                                    .el-tabs__item.is-active{
                                        color: #2A82E2;
                                    }
                                    .el-tabs__active-bar{
                                        height: 3px;
                                        background-color: #2A82E2;
                                        border-radius: 4px;
                                    }
                                }
                            }
                        }
                        .el-tabs__nav-wrap::after{
                            height: 1px;
                            background-color: #EEF0F3;
                            border-radius: 4px;
                        }
                    }
                    .el-tabs__content{
                        .el-tab-pane{
                            font-size: 14px;
                            font-family: PingFangSC-Regular, PingFang SC;
                            font-weight: 400;
                            color: rgba(0, 0, 0, 0.9);
                            .el-select{
                                .el-input{
                                    .el-input__inner{
                                        width: 160px;
                                        height: 32px;
                                        border-radius: 2px;
                                        border: 1px solid #DDDFE6;
                                    }
                                    .el-input__suffix{
                                        .el-input__suffix-inner{
                                            .el-input__icon{
                                                line-height:32px;
                                            }
                                        }
                                    }
                                }
                            }
                            .el-input{
                                width: 160px;
                                height: 32px;
                                .el-input__inner{
                                    height:100%;
                                    border-radius: 2px;
                                    border: 1px solid #DDDFE6;
                                }
                            }
                            .el-textarea{
                                width: 310px;
                                .el-textarea__inner{
                                    height: 100px;
                                    border-radius: 2px;
                                    border: 1px solid #DDDFE6;
                                    resize:none;
                                }
                            }
                            .search_list{
                                margin-bottom:12px;
                            }
                            .phone_search_list{
                                display:flex;
                                margin-bottom:0;
                                .text{
                                    .mandatory_logo,.search_text{
                                        display:inline-block;
                                        transform:translateY(10px);
                                    }
                                    .mandatory_logo{
                                        transform:translateY(13px);
                                    }
                                }
                                .phone_content{
                                    .input_text{
                                        margin-bottom:16px;
                                        .el-icon-circle-plus-outline{
                                            margin-left:8px;
                                        }
                                        .el-input{
                                            width:320px;
                                        }
                                    }
                                }
                            }
                            .hospital{
                                .el-autocomplete{
                                    .el-input{
                                        .el-input__inner{
                                            width: 320px;
                                            height: 32px;
                                            border-radius: 2px;
                                            border: 1px solid #DDDFE6;
                                        }
                                    }
                                }
                            }
                            .depart{
                                .el-select{
                                    width:320px;
                                    .el-input{
                                        width:100%;
                                        .el-input__inner{
                                            width:100%;
                                        }
                                    }
                                }
                            }
                            .depart,.techtitle,.executetitle{
                                padding-left:8px;
                            }
                        }
                        .basic_label{
                            .option{
                                .text_input,.checkbox_select{
                                    .el-select{
                                        .el-input{
                                            width: 320px;
                                            .el-input__inner{
                                                width: 100%;
                                            }
                                        }
                                    }
                                    .el-input{
                                        .el-input__inner{
                                            width: 320px;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            .el-dialog__footer{
                padding:0;
                display:flex;
                justify-content:center;
                margin-top:28px;
                .el-button{
                    height: 32px;
                    border-radius: 2px;
                    border: 1px solid #AAAAAA;
                    padding:6px 36px;
                    font-size: 14px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                }
                button:first-child{
                    background-color: #FFFFFF;
                    color: #767676;
                }
                button:first-child:hover{
                    color: #2A82E2;
                }
                button:last-child{
                    background-color: #2A82E2;
                    color: #FFFFFF;
                    border-color:transparent;
                }
                button:last-child:hover{
                    background-color: rgba(42, 130, 226, 0.7);
                }
                button:last-child:active{
                    background-color: #1F6DC3;
                }
            }
        }
    }
    

    i {
      font-size: 20px;
    }
}
</style>
